INPUTNAME=final
PAPERNAME=final
TEXFILES = abstract.tex \
           introduction.tex \
           architecture.tex \
           implementation.tex \
           casestudy.tex \
           evaluation.tex \
           relatedwork.tex \
           conclusion.tex 
          
DEPENDENCIES = $(INPUTNAME).tex $(TEXFILES) propref.bib
LATEX = latex -halt-on-error 

# Default to compile when no specification is provided:
all: $(PAPERNAME).pdf

ps: $(PAPERNAME).ps
pdf: $(PAPERNAME).pdf

$(PAPERNAME).ps: $(DEPENDENCIES)
	$(LATEX)  $(INPUTNAME)
	bibtex $(INPUTNAME)
#	./fixbibtex.perl $(INPUTNAME).bbl
	$(LATEX)  $(INPUTNAME)
	$(LATEX)  $(INPUTNAME)
	dvips -K -Ppdf -G0 -t letter -o $(PAPERNAME).ps $(INPUTNAME)

$(PAPERNAME).pdf: $(PAPERNAME).ps
	ps2pdf -dCompatibilityLevel=1.3 $(PAPERNAME).ps

gv: $(PAPERNAME).ps
	gv $(PAPERNAME).ps &

tar:
	tar --ignore-failed-read -cvzf $(PAPERNAME).tgz *.tex *.bib fig/*.eps Makefile

clean:
	rm -f $(PAPERNAME).ps $(PAPERNAME).pdf $(PAPERNAME).tgz *.dvi *.aux *.log *.blg *.bbl *~

quick: $(DEPENDENCIES)
	$(LATEX) $(INPUTNAME)
	dvips -K -P amz -P cmz -P web -t letter -o $(PAPERNAME).ps $(INPUTNAME)

